﻿using CL.Enum.Common;
using CL.Enum.Common.Lottery;
using CL.Game.BLL;
using CL.Game.Entity;
using CL.Tools.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace CL.Admin.admin.room
{
    public partial class lookedit : UI.AdminPage
    {
        protected static long RoomID = 0;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                RoomID = QPRequest.GetLong("id");
                if (RoomID > 0)
                    BindData();
            }
        }

        public void BindData()
        {
            LotteryRoomBLL LRBLL = new LotteryRoomBLL();
            RoomManagerBLL RMBLL = new RoomManagerBLL();
            RoomRebateBLL RRBLL = new RoomRebateBLL();
            #region 房间信息
            LotteryRoomEntity LREntity = LRBLL.QueryEentity(RoomID);
            if (LREntity != null)
            {
                txtLottery.Text = Common.GetDescription((LotteryInfo)LREntity.LotteryCode);
                txtRoomName.Text = LREntity.RoomName;
                txtRoomCode.Text = LREntity.RoomCode;
                txtRoomNums.Text = LREntity.RoomNums.ToString();
                txtFrequency.Text = LREntity.Frequency.ToString();
                txtCreateUser.Text = LREntity.CreateUser == 0 ? "--" : "";
                txtCreateTime.Text = LREntity.CreateTime.ToString("yyyy-MM-dd HH:mm:ss");
                txtModifyTime.Text = LREntity.ModifyTime.ToString("yyyy-MM-dd HH:mm:ss");
                txtIsEnable.Text = LREntity.IsEnable == true ? "启用" : "禁用";
                txtRoomAuthor.Text = LREntity.RoomAuthor == 0 ? "--" : "";
                txtRoomNotice.Text = LREntity.RoomNotice;
            }
            #endregion
            #region 房间管理员信息
            List<RoomManagerEntity> RMEntitys = RMBLL.QueryListByRoomID(RoomID);
            rptList_Manager.DataSource = RMEntitys;
            rptList_Manager.DataBind();
            #endregion
            #region 房间反水信息
            List<RoomRebateEntity> RREntitys = RRBLL.QueryListByRoomID(RoomID);
            rptList_Rebate.DataSource = RREntitys;
            rptList_Rebate.DataBind();
            #endregion
        }
        protected string SetChat(string obj)
        {
            string Rec = string.Empty;
            if (obj == null)
                Rec = "--";
            else
            {
                switch (Convert.ToString(obj))
                {
                    case "all":
                        Rec = "无限制条件";
                        break;
                    case "full":
                        Rec = "实名认证";
                        break;
                    case "mobile":
                        Rec = "绑定手机号码";
                        break;
                    case "bank":
                        Rec = "绑定银行卡";
                        break;
                }
            }
            return Rec;
        }
    }
}